import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:nine_grid_view/nine_grid_view.dart';
import 'package:personinfo/utils/commonUtil.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';

import 'MyGallery.dart';

class CircleImageView extends StatefulWidget{
  final List<String> imageUrls;
  const CircleImageView({super.key, required this.imageUrls});
  @override
  State<StatefulWidget> createState() => _CircleImageView();

}

class _CircleImageView extends State<CircleImageView>{
  @override
  Widget build(BuildContext context) {
    return NineGridView(
      width: (CommonUtil.screenWidth(context).width - 140),
      space: 5,
      margin: EdgeInsets.fromLTRB(0, 10, 20, 20),
      padding: EdgeInsets.all(0),
      itemBuilder: (BuildContext context, int index) {
        return GestureDetector(
          onTap: (){
            showCupertinoDialog(
              context: context,
              builder: (BuildContext context) =>
                  MyGallery(imageList: widget.imageUrls ,index: index,)
            );
          },
          child: Image.asset(widget.imageUrls[index], fit: BoxFit.cover,),
        );
      },
      itemCount: widget.imageUrls.length,
    );
  }

}